/*
 *                                                     __----~~~~~~~~~~~------___
 *                                    .  .   ~~//====......          __--~ ~~
 *                    -.            \_|//     |||\\  ~~~~~~::::... /~
 *                 ___-==_       _-~o~  \/    |||  \\            _/~~-
 *         __---~~~.==~||\=_    -_--~/_-~|-   |\\   \\        _/~
 *     _-~~     .=~    |  \\-_    '-~7  /-   /  ||    \      /
 *   .~       .~       |   \\ -_    /  /-   /   ||      \   /
 *  /  ____  /         |     \\ ~-_/  /|- _/   .||       \ /
 *  |~~    ~~|--~~~~--_ \     ~==-/   | \~--===~~        .\
 *           '         ~-|      /|    |-~\~~       __--~~
 *                       |-~~-_/ |    |   ~\_   _-~            /\
 *                            /  \     \__   \/~                \__
 *                        _--~ _/ | .-~~____--~-/                  ~~==.
 *                       ((->/~   '.|||' -_|    ~~-/ ,              . _||
 *                                  -_     ~\      ~~---l__i__i__i--~~_/
 *                                  _-~-__   ~)  \--______________--~~
 *                                //.-~~~-~_--~- |-------~~~~~~~~
 *                                       //.-~~~--\
 *                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 * 
 *                               神兽保佑            永无BUG
 */

/*
 * @Author: nengwu 409791297@qq.com
 * @Date: 2020-06-24 00:06:02
 * @LastEditors: mylesshie@gmail.com
 * @LastEditTime: 2020-07-02 10:29:45
 * @description:
 */
import {
  GET_COLUMNS,
  GET_ARTICLES,
  GET_ARTICLE_DETAIL,
  GET_BANNERS,
  DO_SEARCH
} from '@/constants/main'
import createAction from '@/libs/createAction'

/**
 * @description: 获取栏目列表
 * @param {type}
 */
export const getColumns = () =>
  createAction({
    type: GET_COLUMNS,
    url: '/ct/pageconfig/column-info/getColumns'
  })

/**
 * @description: 获取对应栏目的帖子
 * @param {type} 
 */
export const getArtiles = (colId, pageNum, pageSize) => 
  createAction({  
    type: GET_ARTICLES,
    url: '/ct/article/article/getArticleByCol',
    params: {
      artStatus: 0, //帖子状态
      descs: ['string'], // 排序
      colId,
      pageNum,
      pageSize
    }
  })

/**
 * @description: 获取文章详情
 * @param {type} 
 */
export const getArticleDetail = id => createAction({
  type: GET_ARTICLE_DETAIL,
  url: `/ct/article/article/getArticleDetail?id=${id}`,
  params: {
    id
  }
})

/**
 * @description: 获取轮播图列表
 * @param {type} 
 */
export const getBanners = () => createAction({
  type: GET_BANNERS,
  url: '/ct/pageconfig/loop-img/getLoopImg'
})

/**
 * @description: 搜索
 * @param {type} 
 */
export const doSearch = content => createAction({
  type: DO_SEARCH,
  url: `/ct/pageconfig/first-page/search?content=${content}`
})